package utils

import (
	"crypto/md5"
	"crypto/sha1"
	"crypto/sha256"
	"encoding/hex"
	"fmt"
)

func GetMd5Value(data string) string {
	md5Ctx := md5.New()
	md5Ctx.Write([]byte(data))
	return hex.EncodeToString(md5Ctx.Sum(nil))
}

func GetSha256Value(data string) string {
	h := sha256.New()
	h.Write([]byte(data))
	return hex.EncodeToString(h.Sum(nil))
}

func GetSha1Value(data string) string {
	h := sha1.New()
	h.Write([]byte(data))
	return fmt.Sprintf("%x", h.Sum(nil))
}
